package com.imooc.pay.config;

import com.lly835.bestpay.enums.BestPayPlatformEnum;
import com.lly835.bestpay.enums.BestPayResultEnum;
import com.lly835.bestpay.enums.BestPayTypeEnum;
import com.lly835.bestpay.exception.BestPayException;

public enum TestEnum {

    ALIPAY_APP("alipay_app", BestPayPlatformEnum.ALIPAY, "支付宝app"),
    ALIPAY_PC("alipay_pc", BestPayPlatformEnum.ALIPAY, "支付宝pc"),
    ALIPAY_WAP("alipay_wap", BestPayPlatformEnum.ALIPAY, "支付宝wap"),
    WXPAY_MP("JSAPI", BestPayPlatformEnum.WX, "微信公众账号支付"),
    WXPAY_MWEB("MWEB", BestPayPlatformEnum.WX, "微信H5支付"),
    WXPAY_NATIVE("NATIVE", BestPayPlatformEnum.WX, "微信Native支付"),
    WXPAY_MINI("JSAPI", BestPayPlatformEnum.WX, "微信小程序支付"),
    WXPAY_APP("APP", BestPayPlatformEnum.WX, "微信APP支付");

    private String code;
    private BestPayPlatformEnum platform;
    private String desc;

    private TestEnum(String code, BestPayPlatformEnum platform, String desc) {
        this.code = code;
        this.platform = platform;
        this.desc = desc;
    }

    public String getCode() {
        return this.code;
    }

    public BestPayPlatformEnum getPlatform() {
        return this.platform;
    }

    public String getDesc() {
        return this.desc;
    }

    public static TestEnum getByName(String code) {
        TestEnum[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            TestEnum bestPayTypeEnum = var1[var3];
            if (bestPayTypeEnum.name().equalsIgnoreCase(code)) {
                return bestPayTypeEnum;
            }
        }

        throw new BestPayException(BestPayResultEnum.PAY_TYPE_ERROR);
    }

    public static void main(String[] args){
        System.out.println(TestEnum.WXPAY_NATIVE);

        System.out.println(TestEnum.getByName("alipay_wap"));
    }
}
